﻿// Decompiled with JetBrains decompiler
// Type: System.Web.Razor.Generator.SetVBOptionCodeGenerator
// Assembly: System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// MVID: 682513D6-F37E-48AC-9909-F3EE103CFF14
// Assembly location: D:\Project\Idea\无人机外网\uav\客户端工程\排查工具\bin\Release\System.Web.Razor.dll

using System.Web.Razor.Parser.SyntaxTree;

namespace System.Web.Razor.Generator
{
  /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Represents the conversion of the SetVBOptionCodeGenerator of the value.</summary>
  public class SetVBOptionCodeGenerator : SpanCodeGenerator
  {
    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Represents the strict code Dom option name.</summary>
    public static readonly string StrictCodeDomOptionName = "AllowLateBound";
    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Represents the explicit code Dom option name.</summary>
    public static readonly string ExplicitCodeDomOptionName = "RequireVariableDeclaration";

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Initializes a new instance of the <see cref="T:System.Web.Razor.Generator.SetVBOptionCodeGenerator" /> class.</summary>
    /// <param name="optionName">The option name.</param>
    /// <param name="value">true if the object has a value; otherwise, false.</param>
    public SetVBOptionCodeGenerator(string optionName, bool value)
    {
      this.OptionName = optionName;
      this.Value = value;
    }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets the option name for the code generator.</summary>
    /// <returns>The option name for the code generator.</returns>
    public string OptionName { get; private set; }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Gets a value that indicates whether the <see cref="T:System.Web.Razor.Generator.SetVBOptionCodeGenerator" /> has a value.</summary>
    /// <returns>true if the <see cref="T:System.Web.Razor.Generator.SetVBOptionCodeGenerator" /> has a value; otherwise, false.</returns>
    public bool Value { get; private set; }

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Strictly converts the <see cref="T:System.Web.Razor.Generator.SetVBOptionCodeGenerator" /> to the on and off value.</summary>
    /// <returns>The <see cref="T:System.Web.Razor.Generator.SetVBOptionCodeGenerator" /> strictly converts to the on and off value.</returns>
    /// <param name="onOffValue">true if the <see cref="T:System.Web.Razor.Generator.SetVBOptionCodeGenerator" /> strictly converts to the on and off value; otherwise, false.</param>
    public static SetVBOptionCodeGenerator Strict(bool onOffValue) => new SetVBOptionCodeGenerator(SetVBOptionCodeGenerator.StrictCodeDomOptionName, !onOffValue);

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Converts the <see cref="T:System.Web.Razor.Generator.SetVBOptionCodeGenerator" /> explicitly to the on and off value.</summary>
    /// <returns>The <see cref="T:System.Web.Razor.Generator.SetVBOptionCodeGenerator" /> explicitly converts to the on and off value.</returns>
    /// <param name="onOffValue">true if the <see cref="T:System.Web.Razor.Generator.SetVBOptionCodeGenerator" /> converts to on and off value; otherwise, false.</param>
    public static SetVBOptionCodeGenerator Explicit(bool onOffValue) => new SetVBOptionCodeGenerator(SetVBOptionCodeGenerator.ExplicitCodeDomOptionName, onOffValue);

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Generates code for the specified parameters.</summary>
    /// <param name="target">The target.</param>
    /// <param name="context">The code generator context.</param>
    public override void GenerateCode(Span target, CodeGeneratorContext context) => context.CompileUnit.UserData[(object) this.OptionName] = (object) this.Value;

    /// <summary>This type/member supports the .NET Framework infrastructure and is not intended to be used directly from your code.Returns a String that represents the current Object.</summary>
    /// <returns>A String that represents the current Object.</returns>
    public override string ToString() => "Option:" + this.OptionName + "=" + this.Value.ToString();
  }
}
